<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
                
       
        str = '零一二三四五六七八九十';
        var num = prompt('数字');
        var arr = String(num)
        var content = '';
        var res=''
        for(let i = 0;i < arr.length;i++ ){
        (arr.charAt(i)>=0&&arr.charAt(i)<10) ? content += str[arr.charAt(i)] : '';  
        }
         console.log(content);
         const arr2 = ['','','十','百','千','万','十','百','千','亿']
         var a = content.length;
          var b = 0
        var c = 5;
        
        while(a <= 9 && a >= 5){
            let count = 0
            if(content.charAt(b) == '零'){
                res += content.charAt(b);
            }else{
                  res += content.charAt(b) + arr2[a]+''
            }
            a--;
            b++;
            if(a < 0){
                break;
            }
        } 
        while(a < 5){
            if(content.charAt(b) == '零'){
                res += content.charAt(b);
            }else{
                  res += content.charAt(b) + arr2[a]+''
            }
            a--;
            b++;
            if(a < 0){
                break;
            }
        }
         alert(res);
       
         

    </script>
</body>
</html>